
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>AyoComponent基础库--Activity和Fragment · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="systembartint.html" />
    
    
    <link rel="prev" href="design.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">----安卓 UI----</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="view.html">
            
                <a href="view.html">
            
                    
                    自定义控件和measure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="canvas-paint.html">
            
                <a href="canvas-paint.html">
            
                    
                    draw和canvas，paint详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="anim.html">
            
                <a href="anim.html">
            
                    
                    动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="notify.html">
            
                <a href="notify.html">
            
                    
                    notify系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="loading.html">
            
                <a href="loading.html">
            
                    
                    loading系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="status-ui.html">
            
                <a href="status-ui.html">
            
                    
                    StatusUI系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="touch-scroll.html">
            
                <a href="touch-scroll.html">
            
                    
                    滑动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="layout.html">
            
                <a href="layout.html">
            
                    
                    Layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="textview.html">
            
                <a href="textview.html">
            
                    
                    TextView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="drawable.html">
            
                <a href="drawable.html">
            
                    
                    Drawable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="item-template.html">
            
                <a href="item-template.html">
            
                    
                    列表Adapter模板化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="recyclerview.html">
            
                <a href="recyclerview.html">
            
                    
                    RecyclerView全解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="design.html">
            
                <a href="design.html">
            
                    
                    MeterialDesign详解
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.15" data-path="component.html">
            
                <a href="component.html">
            
                    
                    AyoComponent基础库--Activity和Fragment
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="systembartint.html">
            
                <a href="systembartint.html">
            
                    
                    SystembarTint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="permission-ask.html">
            
                <a href="permission-ask.html">
            
                    
                    权限控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="keyboard.html">
            
                <a href="keyboard.html">
            
                    
                    小键盘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="notification.html">
            
                <a href="notification.html">
            
                    
                    Notification
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----安卓 foundation----</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="mvp.html">
            
                <a href="mvp.html">
            
                    
                    MVP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="rxjava.html">
            
                <a href="rxjava.html">
            
                    
                    RxJava
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="lang.html">
            
                <a href="lang.html">
            
                    
                    常用工具类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="http.html">
            
                <a href="http.html">
            
                    
                    http
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="xml.html">
            
                <a href="xml.html">
            
                    
                    xml解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="json-reporter.html">
            
                <a href="json-reporter.html">
            
                    
                    Json解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="inject.html">
            
                <a href="inject.html">
            
                    
                    ButterKnife
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="thread.html">
            
                <a href="thread.html">
            
                    
                    安卓线程和looper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="process.html">
            
                <a href="process.html">
            
                    
                    多进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="eventbus.html">
            
                <a href="eventbus.html">
            
                    
                    EventBus
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="db.html">
            
                <a href="db.html">
            
                    
                    数据库和ContentProvider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="job.html">
            
                <a href="job.html">
            
                    
                    定时任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="service.html">
            
                <a href="service.html">
            
                    
                    service
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="opt-mem.html">
            
                <a href="opt-mem.html">
            
                    
                    内存优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="opt-network.html">
            
                <a href="opt-network.html">
            
                    
                    网络优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="opt-anr.html">
            
                <a href="opt-anr.html">
            
                    
                    anr排查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="opt-ui.html">
            
                <a href="opt-ui.html">
            
                    
                    UI卡顿优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    启动优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="hotfix.html">
            
                <a href="hotfix.html">
            
                    
                    热补丁混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.21" data-path="aar.html">
            
                <a href="aar.html">
            
                    
                    aar相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.22" data-path="route.html">
            
                <a href="route.html">
            
                    
                    Route路由
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.23" data-path="modules.html">
            
                <a href="modules.html">
            
                    
                    分模块，组件化，插件化
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----Gradle----</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="gradle.html">
            
                <a href="gradle.html">
            
                    
                    gradle基本配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="gradle-plugin.html">
            
                <a href="gradle-plugin.html">
            
                    
                    gradle插件开发
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----工具----</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="repos.html">
            
                <a href="repos.html">
            
                    
                    优秀博客，开源项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="packs.html">
            
                <a href="packs.html">
            
                    
                    自动打包，多渠道打包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="gist.html">
            
                <a href="gist.html">
            
                    
                    代码片段和常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="stetho.html">
            
                <a href="stetho.html">
            
                    
                    stetho
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="fabric.html">
            
                <a href="fabric.html">
            
                    
                    fabric
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="app-update.html">
            
                <a href="app-update.html">
            
                    
                    自动升级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="bugsnags.html">
            
                <a href="bugsnags.html">
            
                    
                    日志和崩溃统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="mail.html">
            
                <a href="mail.html">
            
                    
                    发邮件辅助接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="socail.html">
            
                <a href="socail.html">
            
                    
                    第三方登录和分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="pay-alipay.html">
            
                <a href="pay-alipay.html">
            
                    
                    支付宝支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="pay-wx.html">
            
                <a href="pay-wx.html">
            
                    
                    微信支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="umeng.html">
            
                <a href="umeng.html">
            
                    
                    友盟统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="push-jpush.html">
            
                <a href="push-jpush.html">
            
                    
                    推送-极光
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="push-xiaomi.html">
            
                <a href="push-xiaomi.html">
            
                    
                    推送-小米
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >AyoComponent基础库--Activity和Fragment</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="ayocomponent&#x57FA;&#x7840;&#x5E93;">AyoComponent&#x57FA;&#x7840;&#x5E93;</h1>
<p>&#x5BF9;&#x5E94;&#x7684;</p>
<p>&#x5185;&#x5BB9;&#x5305;&#x62EC;&#xFF1A;</p>
<ul>
<li>Activity&#xFF0C;Fragment&#x7EC4;&#x4EF6;&#xFF0C;UI&#x7EC4;&#x4EF6;&#x57FA;&#x4E8E;Fragmentation<ul>
<li>&#x652F;&#x6301;Activity&#x6838;&#x5FC3;&#x6216;&#x8005;Fragment&#x6838;&#x5FC3;</li>
<li>&#x652F;&#x6301;&#x514D;manifest&#x7684;Fragment&#x6838;&#x5FC3;&#xFF0C;&#x652F;&#x6301;Schema&#x548C;&#x5185;&#x5B58;&#x91CD;&#x542F;</li>
</ul>
</li>
<li>WorkThread&#x7684;&#x95EE;&#x9898;&#xFF1A;&#x662F;&#x7528;IntentService&#xFF0C;&#x8FD8;&#x662F;HandlerThread&#xFF0C;&#x8FD8;&#x662F;&#x5F00;&#x7EBF;&#x7A0B;&#x6C60;&#xFF0C;&#x8FD8;&#x662F;&#x7528;AsyncTask&#xFF0C;&#x8FD8;&#x662F;&#x76F4;&#x63A5;new Thread</li>
<li>Service&#xFF0C;Provider&#xFF0C;Receiver</li>
</ul>
<p>&#x6CA1;&#x6574;&#x5230;jcenter&#x4E0A;&#xFF0C;&#x6682;&#x65F6;&#x5C31;&#x7528;aar&#x5305;&#x5427;&#xFF0C;&#x4E5F;&#x633A;&#x7701;&#x52B2;&#xFF1A;<a href="https://github.com/cowthan/AyoCompoment/blob/master/ayo-component.aar?raw=true" target="_blank">&#x4E0B;&#x8F7D;&#x5730;&#x5740;</a>
&#x4E0B;&#x8F7D;&#x4E0B;&#x6765;&#x6587;&#x4EF6;&#x540D;&#x662F;&#xFF1A;ayo-component.aar&#xFF0C;&#x62F7;&#x5230;libs&#x76EE;&#x5F55;&#x91CC;
&#x7136;&#x540E;&#x5728;build.gradle&#x91CC;&#x5F15;&#x5165;&#xFF1A;</p>
<pre><code>repositories {
    flatDir {
        dirs &apos;libs&apos;
    }
}

compile(name:&apos;ayo-component&apos;, ext:&apos;aar&apos;)
</code></pre><p>&#x76EE;&#x5F55;&#xFF1A;</p>
<ul>
<li>MasterFragment&#x4F7F;&#x7528;<ul>
<li>&#x4E3B;&#x9898;&#xFF1A;Theme&#xFF0C;Material Theme</li>
<li>&#x6A21;&#x677F;Activity&#x58F0;&#x660E;&#xFF1A;&#x5185;&#x7F6E;&#x548C;&#x81EA;&#x5B9A;&#x4E49;&#xFF0C;Activity&#x5728;manifest&#x91CC;&#x914D;&#x7F6E;&#x7684;&#x53EF;&#x9009;&#x9879;</li>
<li>&#x5C4F;&#x5E55;&#x65CB;&#x8F6C;</li>
<li>SystemBar&#x4E00;&#x4F53;&#x5316;&#x95EE;&#x9898;</li>
<li>&#x542F;&#x52A8;&#x52A0;&#x901F;</li>
<li>ayo-menu&#x7684;&#x4F7F;&#x7528;&#xFF1A;&#x5199;demo&#x65F6;&#x7528;&#x7684;&#x83DC;&#x5355;&#x7EC4;&#x4EF6;</li>
</ul>
</li>
<li>WorkThread&#xFF0C;Service&#x95EE;&#x9898;</li>
<li>ContentProvider&#x662F;&#x5426;&#x5E94;&#x8BE5;&#x4F5C;&#x4E3A;&#x4F60;app&#x5185;&#x6570;&#x636E;&#x5E93;&#x7BA1;&#x7406;&#x7684;&#x7B2C;&#x4E00;&#x9009;&#x62E9;</li>
<li>Receiver&#x548C;EventBus&#x7684;&#x9009;&#x62E9;&#xFF0C;EventBus&#x80FD;&#x8DE8;&#x8FDB;&#x7A0B;&#x5417;</li>
<li>&#x591A;&#x8FDB;&#x7A0B;&#x95EE;&#x9898;&#x7684;&#x8003;&#x8651;</li>
</ul>
<h2 id="1-masterfragment&#x4F7F;&#x7528;">1 MasterFragment&#x4F7F;&#x7528;</h2>
<ul>
<li>Master&#x6846;&#x67B6;&#x90FD;&#x63D0;&#x4F9B;&#x4E86;&#xFF1A;<ul>
<li>Fragmentation&#x7684;&#x62F7;&#x8D1D;&#x548C;&#x4FEE;&#x6539;&#xFF08;&#x751F;&#x547D;&#x5468;&#x671F;&#x76F8;&#x5173;&#x4FEE;&#x6539;&#xFF09;</li>
<li>MasterFragment&#xFF1A;&#x57FA;&#x4E8E;Fragmentation&#xFF0C;&#x53EF;&#x4EE5;&#xFF1A;<ul>
<li>&#x901A;&#x8FC7;Master&#x7684;startPage&#x65B9;&#x6CD5;&#x548C;&#x4E00;&#x4E2A;&#x9884;&#x5148;&#x58F0;&#x660E;&#x7684;&#x6A21;&#x677F;Activity&#x7ED1;&#x5B9A;&#xFF0C;&#x8FBE;&#x5230;&#x514D;manifest&#x7684;&#x76EE;&#x7684;</li>
<li>&#x53EF;&#x4EE5;&#x5D4C;&#x5728;MasterActivity&#x91CC;&#xFF0C;&#x8FD9;&#x4E2A;&#x65B9;&#x5F0F;&#x5C31;&#x662F;&#x6700;&#x4F20;&#x7EDF;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x7528;Activity&#x52A0;&#x8F7D;Fragment</li>
<li>&#x53EF;&#x4EE5;&#x5D4C;&#x5728;MasterFragment&#x91CC;&#xFF0C;&#x8FD9;&#x4E2A;&#x65B9;&#x5F0F;&#x4E5F;&#x662F;&#x4F20;&#x7EDF;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x7528;Fragment&#x52A0;&#x8F7D;Fragment</li>
</ul>
</li>
<li>&#x4E0D;&#x8BBA;&#x662F;MasterActivity&#xFF0C;&#x8FD8;&#x662F;MasterFragment&#xFF0C;&#x90FD;&#x53EF;&#x4EE5;&#xFF1A;<ul>
<li>&#x52A0;&#x8F7D;&#x4E00;&#x4E2A;Fragment&#xFF0C;&#x6210;&#x4E3A;&#x5176;&#x7236;</li>
<li>&#x540C;&#x65F6;&#x663E;&#x793A;&#x591A;&#x4E2A;Fragment&#xFF0C;&#x6210;&#x4E3A;&#x4ED6;&#x4EEC;&#x7684;&#x7236;</li>
<li>&#x540C;&#x65F6;&#x6253;&#x5F00;&#x591A;&#x4E2A;&#xFF0C;&#x5E76;&#x901A;&#x8FC7;show&#x548C;hide&#x63A7;&#x5236;&#xFF0C;&#x8FD9;&#x4E9B;child&#x4E4B;&#x95F4;&#x4E0D;&#x4F1A;&#x6709;&#x540E;&#x9000;&#x5173;&#x7CFB;</li>
<li>&#x901A;&#x8FC7;ViewPager&#x7BA1;&#x7406;&#x591A;&#x4E2A;Fragment</li>
<li>&#x6253;&#x5F00;&#x591A;&#x4E2A;&#xFF0C;&#x4F46;&#x4E0D;&#x662F;&#x540C;&#x65F6;&#x6253;&#x5F00;&#xFF0C;&#x901A;&#x8FC7;add&#xFF0C;pop&#x7B49;&#x63A7;&#x5236;&#xFF0C;&#x4F1A;&#x6709;&#x540E;&#x9000;&#x5173;&#x7CFB;</li>
</ul>
</li>
<li>MasterFragment&#x548C;MasterActivity&#xFF0C;&#x8FD8;&#x8003;&#x8651;&#x4E86;&#xFF1A;<ul>
<li>&#x548C;Fragment&#x76F8;&#x5173;&#x7684;&#x5185;&#x5B58;&#x91CD;&#x542F;&#xFF0C;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x5728;create&#x65F6;&#x5224;&#x65AD;saveStateInstance&#x662F;&#x5426;&#x4E3A;&#x7A7A;&#xFF0C;&#x4E0D;&#x8981;&#x91CD;&#x590D;load fragment<ul>
<li>fragment&#x672C;&#x8EAB;&#x4F1A;&#x5728;&#x5176;&#x7236;&#x4E2D;&#x88AB;save&#x548C;&#x6062;&#x590D;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x8BFB;&#x51FA;&#x6765;</li>
<li>fragment&#x7684;setArgument&#x5E26;&#x7684;&#x53C2;&#x6570;&#x4F1A;save&#x548C;&#x6062;&#x590D;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x8BFB;&#x51FA;&#x6765;</li>
</ul>
</li>
<li>Schema</li>
<li>&#x8FC7;&#x573A;&#x52A8;&#x753B;</li>
<li>Transition&#x52A8;&#x753B;</li>
<li>&#x6ED1;&#x52A8;&#x8FD4;&#x56DE;</li>
<li>SystemBar&#x4E00;&#x4F53;&#x5316;</li>
<li>&#x751F;&#x547D;&#x5468;&#x671F;&#xFF0C;&#x4FBF;&#x4E8E;&#x7EDF;&#x8BA1;</li>
<li>Fragment&#x53EF;&#x89C1;&#x548C;&#x4E0D;&#x53EF;&#x89C1;&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;&#xFF0C;&#x4EE5;&#x53CA;&#x662F;&#x5426;&#x7B2C;&#x4E00;&#x6B21;&#x53EF;&#x89C1;&#xFF0C;&#x90FD;&#x4FDD;&#x8BC1;View&#x5DF2;&#x7ECF;&#x521D;&#x59CB;&#x5316;&#xFF0C;&#x4EE3;&#x66FF;ViewPager&#x7684;setUserHintVisi..&#xFF0C;&#x53EF;&#x4EE5;&#x771F;&#x6B63;&#x5B9E;&#x73B0;Fragment&#x5404;&#x5904;&#x901A;&#x7528;</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="1-&#x5230;&#x5E95;&#x7528;&#x4EC0;&#x4E48;ui&#x6846;&#x67B6;">1 &#x5230;&#x5E95;&#x7528;&#x4EC0;&#x4E48;UI&#x6846;&#x67B6;</h3>
<ul>
<li>&#x5148;&#x8BF4;&#x8BF4;&#x90FD;&#x6709;&#x4EC0;&#x4E48;UI&#x6846;&#x67B6;<ul>
<li>&#x672C;&#x9879;&#x76EE;&#x7684;&#x521D;&#x8877;&#xFF1A;&#x514D;Manifest&#x6846;&#x67B6;<ul>
<li>tmpl&#x91CC;&#x7684;&#x51E0;&#x4E2A;Activity&#x9700;&#x8981;&#x4E8B;&#x5148;&#x58F0;&#x660E;&#xFF0C;&#x5F53;&#x7136;&#x4E5F;&#x53EF;&#x4EE5;&#x81EA;&#x5DF1;&#x5B9A;&#x5236;&#xFF0C;&#x81EA;&#x5DF1;&#x5904;&#x7406;Fragment&#x52A0;&#x8F7D;&#x548C;schema&#x7B49;&#x95EE;&#x9898;</li>
<li>&#x5B9E;&#x73B0;&#x4E1A;&#x52A1;Fragment&#xFF0C;&#x9700;&#x8981;&#x7EE7;&#x627F;MasterFragment&#xFF0C;&#x6CE8;&#x610F;&#x51E0;&#x4E2A;&#x751F;&#x547D;&#x5468;&#x671F;</li>
<li>&#x6253;&#x5F00;Fragment&#xFF1A;<ul>
<li>&#x4F60;&#x53EF;&#x4EE5;&#x518D;&#x5199;&#x4E00;&#x4E2A;Activity&#xFF08;&#x7EE7;&#x627F;MasterActivty&#xFF09;&#xFF0C;&#x6765;&#x52A0;&#x8F7D;&#x4F60;&#x7684;Fragment&#xFF0C;&#x8FD9;&#x662F;&#x4F20;&#x7EDF;&#x5957;&#x8DEF;</li>
<li>&#x4F60;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;Master&#x91CC;&#x7684;startPage&#x65B9;&#x6CD5;&#xFF0C;&#x6253;&#x5F00;&#x4F60;&#x7684;Fragment&#xFF0C;&#x8FD9;&#x4E2A;&#x65B9;&#x5F0F;&#x53EF;&#x4EE5;&#x4E0D;&#x7528;&#x5728;manifest&#x518D;&#x58F0;&#x660E;&#x4EC0;&#x4E48;</li>
</ul>
</li>
<li>&#x652F;&#x6301;MasterTabFragment&#xFF0C;&#x548C;MasterPagerFragment&#xFF0C;&#x8FD9;&#x4FE9;&#x662F;Tab&#x9875;&#x548C;ViewPager&#x9875;</li>
</ul>
</li>
<li>&#x7531;&#x4E8E;&#x62F7;&#x8FDB;&#x4E86;Fragmentation&#xFF0C;&#x6240;&#x4EE5;&#x4E5F;&#x652F;&#x6301;&#x5B83;&#x7684;&#x51E0;&#x4E2A;&#x5178;&#x578B;&#x6846;&#x67B6;&#x4E86;&#xFF1A;<ul>
<li>&#x4E00;&#x4E2A;Activity&#xFF0C;&#x591A;&#x4E2A;Fragment&#xFF1A;&#x8FD9;&#x4E9B;Fragment&#x53EF;&#x4EE5;&#x662F;&#x5E73;&#x7EA7;&#xFF0C;&#x6709;&#x6808;&#x5173;&#x7CFB;&#xFF0C;&#x6709;for result&#x5173;&#x7CFB;</li>
<li>&#x591A;&#x4E2A;Activity&#xFF0C;&#x591A;&#x4E2A;Fragment&#xFF1A;&#x548C;&#x5355;Activity&#x672C;&#x8D28;&#x4E00;&#x6837;</li>
<li>&#x5173;&#x4E8E;Fragmentation&#x7684;&#x9AD8;&#x7EA7;&#x7528;&#x6CD5;&#xFF0C;&#x54B1;&#x5148;&#x4E0D;&#x8003;&#x8651;&#xFF0C;&#x6682;&#x65F6;&#x5C31;&#x628A;Fragmentation&#x5F53;&#x6210;&#x4E00;&#x4E2A;&#x5C01;&#x88C5;&#x4E86;Fragment&#x751F;&#x547D;&#x5468;&#x671F;&#x7684;&#x529F;&#x80FD;&#x6A21;&#x5757;</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="2-theme&#x914D;&#x7F6E;">2 Theme&#x914D;&#x7F6E;</h3>
<p>Master&#x662F;&#x57FA;&#x4E8E;AppCompatActivity&#xFF0C;&#x4E5F;&#x5C31;&#x53EA;&#x80FD;&#x7528;AppCompat&#x7684;&#x4E3B;&#x9898;&#xFF0C;&#x8FD9;&#x7C7B;&#x4E3B;&#x9898;&#x4F1A;&#x6309;&#x7167;API 21&#x5212;&#x5206;&#xFF0C;21&#x4EE5;&#x4E0A;&#x4F1A;&#x52A0;&#x8F7D;Material&#x7684;&#x4E3B;&#x9898;&#xFF0C;&#x6240;&#x4EE5;&#x4E5F;&#x652F;&#x6301;Transition&#x7B49;design&#x7684;&#x4E1C;&#x897F;</p>
<pre><code>------values&#x76EE;&#x5F55;&#x7684;style.xml
&lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
    &lt;!-- Customize your theme here. --&gt;
    &lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
    &lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
    &lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;

    &lt;item name=&quot;android:windowNoTitle&quot;&gt;true&lt;/item&gt;
    &lt;item name=&quot;android:windowContentOverlay&quot;&gt;@null&lt;/item&gt;
    &lt;item name=&quot;android:windowBackground&quot;&gt;@android:color/transparent&lt;/item&gt;
&lt;/style&gt;

&lt;style name=&quot;AppTheme.Splash&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
    &lt;item name=&quot;android:windowBackground&quot;&gt;@drawable/logo&lt;/item&gt;
&lt;/style&gt;

&lt;style name=&quot;AppTheme.Transparent&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
    &lt;item name=&quot;android:windowIsTranslucent&quot;&gt;true&lt;/item&gt;
    &lt;item name=&quot;android:windowAnimationStyle&quot;&gt;@style/Animation.Activity.Translucent.Style&lt;/item&gt;
&lt;/style&gt;

&lt;style name=&quot;Animation.Activity.Style&quot; parent=&quot;@android:style/Animation.Activity&quot;&gt;
    &lt;item name=&quot;android:activityOpenEnterAnimation&quot;&gt;@anim/base_slide_in_from_right&lt;/item&gt;
    &lt;item name=&quot;android:activityOpenExitAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:activityCloseEnterAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:activityCloseExitAnimation&quot;&gt;@anim/base_slide_out_to_right&lt;/item&gt;
    &lt;item name=&quot;android:taskOpenEnterAnimation&quot;&gt;@anim/base_slide_in_from_right&lt;/item&gt;
    &lt;item name=&quot;android:taskOpenExitAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:taskCloseEnterAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:taskCloseExitAnimation&quot;&gt;@anim/base_slide_out_to_right&lt;/item&gt;
    &lt;item name=&quot;android:taskToFrontEnterAnimation&quot;&gt;@anim/base_slide_in_from_right&lt;/item&gt;
    &lt;item name=&quot;android:taskToFrontExitAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:taskToBackEnterAnimation&quot;&gt;@anim/base_hold_stand&lt;/item&gt;
    &lt;item name=&quot;android:taskToBackExitAnimation&quot;&gt;@anim/base_slide_out_to_right&lt;/item&gt;
&lt;/style&gt;

&lt;style name=&quot;Animation.Activity.Translucent.Style&quot; parent=&quot;@android:style/Animation.Translucent&quot;&gt;
    &lt;item name=&quot;android:windowEnterAnimation&quot;&gt;@anim/base_slide_in_from_right&lt;/item&gt;
    &lt;item name=&quot;android:windowExitAnimation&quot;&gt;@anim/base_slide_out_to_right&lt;/item&gt;
&lt;/style&gt;

-------values-21&#x76EE;&#x5F55;&#x7684;style.xml
&lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
    &lt;!-- Customize your theme here. --&gt;
    &lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
    &lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
    &lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;
    &lt;item name=&quot;android:textColorPrimary&quot;&gt;@color/textColorPrimary&lt;/item&gt;
    &lt;item name=&quot;android:navigationBarColor&quot;&gt;@color/navigationBarColor&lt;/item&gt;
    &lt;item name=&quot;android:colorControlHighlight&quot;&gt;@color/colorControlHighlight&lt;/item&gt;

    &lt;item name=&quot;android:windowNoTitle&quot;&gt;true&lt;/item&gt;
    &lt;item name=&quot;android:windowContentOverlay&quot;&gt;@null&lt;/item&gt;
    &lt;item name=&quot;android:windowBackground&quot;&gt;@android:color/transparent&lt;/item&gt;
&lt;/style&gt;


------colors.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
    &lt;color name=&quot;colorPrimary&quot;&gt;#ff0000&lt;/color&gt;
    &lt;color name=&quot;colorPrimaryDark&quot;&gt;#ffff00&lt;/color&gt;
    &lt;color name=&quot;colorAccent&quot;&gt;#00ff00&lt;/color&gt;
    &lt;color name=&quot;colorControlHighlight&quot;&gt;#e60000&lt;/color&gt;
    &lt;color name=&quot;textColorPrimary&quot;&gt;#000000&lt;/color&gt;
    &lt;color name=&quot;navigationBarColor&quot;&gt;#ff00ff&lt;/color&gt;

    &lt;color name=&quot;green&quot;&gt;#a3c639&lt;/color&gt;
    &lt;color name=&quot;dark_green&quot;&gt;#85a71d&lt;/color&gt;
    &lt;color name=&quot;yellow&quot;&gt;#ff0&lt;/color&gt;
    &lt;color name=&quot;gray&quot;&gt;#ccc&lt;/color&gt;
    &lt;color name=&quot;pink&quot;&gt;#e91e63&lt;/color&gt;
&lt;/resources&gt;


-------logo.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;layer-list xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; &gt;
    &lt;item&gt;

        &lt;shape android:shape=&quot;rectangle&quot; &gt;
            &lt;solid android:color=&quot;#ffffff&quot; /&gt;
        &lt;/shape&gt;
    &lt;/item&gt;

    &lt;item android:bottom=&quot;48dp&quot;&gt;
        &lt;bitmap
            android:gravity=&quot;center&quot;
            android:src=&quot;@drawable/img1&quot; /&gt;
    &lt;/item&gt;
&lt;/layer-list&gt;
</code></pre><p>&#x5173;&#x4E8E;Color Pallete&#xFF1A;</p>
<ul>
<li>&#x5355;&#x8BCD;&#x6211;&#x90FD;&#x4E0D;&#x77E5;&#x9053;&#x6709;&#x6CA1;&#x6709;&#x62FC;&#x5BF9;</li>
<li>&#x6709;&#x56FE;&#x5C31;&#x4E0D;&#x7528;&#x8BF4;&#x8BDD;&#xFF1A;
!()[./img/l-design.png)</li>
</ul>
<p>&#x5173;&#x4E8E;windowIsTranslucent&#xFF1A;</p>
<ul>
<li>&#x5927;&#x591A;&#x6570;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x662F;&#x8981;&#x914D;&#x5408;swipe back&#x529F;&#x80FD;&#x6765;&#x4F7F;&#x7528;&#xFF0C;&#x6240;&#x4EE5;&#x6A21;&#x677F;Activity&#x4E3A;&#x4E86;&#x8003;&#x8651;&#x6240;&#x6709;&#x60C5;&#x51B5;&#xFF0C;&#x6700;&#x597D;&#x4F7F;&#x7528;AppTheme.Transparent</li>
<li>&#x8FD9;&#x4E2A;&#x8BBE;&#x4E3A;true&#x4F1A;&#x5F15;&#x5165;&#x4E00;&#x4E9B;&#x95EE;&#x9898;&#xFF0C;&#x5177;&#x4F53;&#x6211;&#x73B0;&#x5728;&#x90FD;&#x60F3;&#x4E0D;&#x8D77;&#x6765;&#xFF0C;&#x4EE5;&#x540E;&#x6162;&#x6162;&#x5728;&#x8FD9;&#x8BB0;&#x5F55;&#x5427;</li>
<li>&#x7B2C;&#x4E00;&#x4E2A;&#x95EE;&#x9898;&#xFF1A;Activity&#x5207;&#x6362;&#x52A8;&#x753B;&#x65E0;&#x6548;&#x5316;&#x4E86;&#xFF0C;&#x9700;&#x8981;&#x81EA;&#x5DF1;&#x8BBE;&#x7F6E;&#xFF0C;&#x53C2;&#x8003;windowAnimationStyle</li>
</ul>
<p>Splash&#x4E3B;&#x9898;&#x4E3A;&#x4EC0;&#x4E48;&#x5355;&#x72EC;&#x62CE;&#x51FA;&#x6765;&#xFF1A;</p>
<ul>
<li>&#x4E3B;&#x8981;&#x662F;&#x4E3A;&#x4E86;&#x8BBE;&#x7F6E;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7684;windowBackground&#xFF0C;&#x907F;&#x514D;app&#x6253;&#x5F00;&#x8FC7;&#x6162;&#x65F6;&#x51FA;&#x73B0;&#x767D;&#x5C4F;&#x6216;&#x8005;&#x6CA1;&#x53CD;&#x5E94;&#x7684;&#x5C34;&#x5C2C;&#xFF0C;&#x4EE5;&#x4E00;&#x4E2A;&#x80CC;&#x666F;&#x5360;&#x4F4D;</li>
<li>&#x6240;&#x4EE5;Splash&#x521D;&#x6B21;&#x6253;&#x5F00;&#x65F6;&#xFF0C;&#x5F85;&#x5728;&#x5C4F;&#x5E55;&#x4E0A;&#x7684;&#x65F6;&#x95F4;&#x53EF;&#x80FD;&#x4F1A;&#x6BD4;&#x4F60;&#x8BBE;&#x7F6E;&#x7684;&#x65F6;&#x95F4;&#x8981;&#x957F;&#xFF0C;&#x957F;&#x51FA;&#x6765;&#x7684;&#x65F6;&#x95F4;&#x5C31;&#x662F;app&#x521D;&#x59CB;&#x5316;&#x65F6;&#x95F4;</li>
<li>&#x5173;&#x4E8E;&#x51B7;&#x542F;&#x52A8;&#xFF0C;&#x70ED;&#x542F;&#x52A8;&#x7684;&#x4F18;&#x5316;&#xFF0C;&#x53C2;&#x8003;&#x8FD9;&#x91CC;&#xFF1A;<a href="http://www.jianshu.com/p/f5514b1a826c?utm_campaign=hugo&amp;utm_medium=reader_share&amp;utm_content=note&amp;utm_source=qq" target="_blank">http://www.jianshu.com/p/f5514b1a826c?utm_campaign=hugo&amp;utm_medium=reader_share&amp;utm_content=note&amp;utm_source=qq</a></li>
</ul>
<h3 id="3-manifest&#x914D;&#x7F6E;&#xFF1A;">3 Manifest&#x914D;&#x7F6E;&#xFF1A;</h3>
<p>&#x4E0B;&#x9762;&#x662F;manifest&#x914D;&#x7F6E;&#xFF1A;</p>
<ul>
<li>&#x6CE8;&#x610F;&#xFF0C;&#x56DB;&#x4E2A;&#x6A21;&#x677F;&#x7684;schema&#x8BBF;&#x95EE;&#x65B9;&#x5F0F;&#x662F;&#xFF1A;ayo://page/standard?page=fragment&#x5168;&#x9650;&#x5B9A;&#x540D;&amp;name=value&quot;<ul>
<li>&#x5176;&#x4E2D;&#xFF0C;name&#x548C;value&#x53EF;&#x4EE5;&#x6709;&#x591A;&#x5BF9;&#xFF0C;&#x90FD;&#x4F1A;&#x88AB;&#x653E;&#x5230;Fragment&#x7684;argument&#x91CC;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x901A;&#x8FC7;bundle&#x4F20;&#x53C2;&#x6570;</li>
<li>page&#x53C2;&#x6570;&#x4E00;&#x5B9A;&#x8981;&#x6709;</li>
<li>&#x5982;&#x679C;&#x6CA1;&#x6709;page&#xFF0C;&#x5219;&#x8868;&#x793A;&#x6253;&#x5F00;&#x7684;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x6A21;&#x677F;Activity&#xFF0C;&#x800C;&#x662F;&#x4E00;&#x4E2A;&#x5177;&#x4F53;Acitity&#xFF0C;&#x5176;&#x5185;&#x90E8;&#x5DF2;&#x7ECF;&#x77E5;&#x9053;&#x81EA;&#x5DF1;&#x8981;&#x52A0;&#x8F7D;&#x54EA;&#x4E2A;Fragment&#x4E86;</li>
</ul>
</li>
</ul>
<pre><code>&lt;activity android:name=&quot;.SplashActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;standard&quot;
    android:theme=&quot;@style/AppTheme.Splash&quot;&gt;
    &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;activity android:name=&quot;.MainActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;standard&quot;
    android:theme=&quot;@style/AppTheme&quot;&gt;
    &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;

&lt;activity
    android:name=&quot;org.ayo.component.tmpl.TmplStarndardActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;standard&quot;
    android:theme=&quot;@style/AppTheme.Transparent&quot; &gt;
    &lt;intent-filter&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;
        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;
        &lt;data android:scheme=&quot;ayo&quot; android:host=&quot;page&quot; android:path=&quot;/standard&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;activity
    android:name=&quot;org.ayo.component.tmpl.TmplSingleTopActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;singleTop&quot;
    android:theme=&quot;@style/AppTheme.Transparent&quot;  &gt;
    &lt;intent-filter&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;
        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;
        &lt;data android:scheme=&quot;ayo&quot; android:host=&quot;page&quot; android:path=&quot;/singletop&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;activity
    android:name=&quot;org.ayo.component.tmpl.TmplSingleTaskActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;singleTask&quot;
    android:theme=&quot;@style/AppTheme.Transparent&quot;  &gt;
    &lt;intent-filter&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;
        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;
        &lt;data android:scheme=&quot;ayo&quot; android:host=&quot;page&quot; android:path=&quot;/singletask&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
&lt;activity
    android:name=&quot;org.ayo.component.tmpl.TmplSingleInstanceActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;singleInstance&quot;
    android:theme=&quot;@style/AppTheme.Transparent&quot;  &gt;
    &lt;intent-filter&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;
        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;
        &lt;data android:scheme=&quot;ayo&quot; android:host=&quot;page&quot; android:path=&quot;/singleinstance&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
</code></pre><h3 id="4-&#x81EA;&#x5B9A;&#x4E49;&#x6A21;&#x677F;activity">4 &#x81EA;&#x5B9A;&#x4E49;&#x6A21;&#x677F;Activity</h3>
<p>&#x53EF;&#x80FD;&#x6709;&#x4E9B;&#x4E1A;&#x52A1;&#x9700;&#x8981;&#x4F60;&#x81EA;&#x5DF1;&#x5B9A;&#x4E49;&#x6A21;&#x677F;Activity&#xFF0C;&#x5982;&#x652F;&#x6301;&#x5C4F;&#x5E55;&#x65CB;&#x8F6C;&#xFF0C;&#x9700;&#x8981;&#x5728;manifest&#x914D;&#x7F6E;&#x4E2A;&#x6027;&#x5316;&#x53C2;&#x6570;&#x7B49;&#xFF0C;&#x7136;&#x540E;&#x5728;manifest&#x58F0;&#x660E;</p>
<pre><code>public class CustomTmplActivity extends TmplBaseActivity {

}

&lt;activity
    android:name=&quot;.master.CustomTmplActivity&quot;
    android:configChanges=&quot;orientation|screenSize|keyboardHidden|navigation&quot;
    android:screenOrientation=&quot;portrait&quot;
    android:launchMode=&quot;standard&quot;
    android:theme=&quot;@style/AppTheme.Transparent&quot;  &gt;
    &lt;intent-filter&gt;
        &lt;category android:name=&quot;android.intent.category.DEFAULT&quot;/&gt;
        &lt;action android:name=&quot;android.intent.action.VIEW&quot;/&gt;
        &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot;/&gt;
        &lt;data android:scheme=&quot;ayo&quot; android:host=&quot;page&quot; android:path=&quot;/custom1&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
</code></pre><h3 id="5-&#x5B9E;&#x73B0;&#x4E1A;&#x52A1;&#x903B;&#x8F91;">5 &#x5B9E;&#x73B0;&#x4E1A;&#x52A1;&#x903B;&#x8F91;</h3>
<p>&#x5F00;&#x59CB;&#x5E72;&#x6D3B;&#x4E86;</p>
<ul>
<li><code>&#x5B9E;&#x73B0;&#x4E1A;&#x52A1;Fragment&#x4E86;&#xFF0C;&#x7EE7;&#x627F;MasterFragment&#xFF0C;MasterTabFragment&#xFF0C;MasterPagerFragment&#x5427;</code></li>
<li>&#x4E0D;&#x8FC7;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF0C;&#x4E00;&#x822C;&#x4F60;&#x7684;&#x9879;&#x76EE;&#x5185;&#x4E0D;&#x4F1A;&#x76F4;&#x63A5;&#x7EE7;&#x627F;MasterFragment&#x4EC0;&#x4E48;&#x7684;&#xFF0C;&#x800C;&#x662F;&#x4F1A;&#x5148;&#x63D0;&#x4F9B;&#x4E00;&#x5C42;&#x57FA;&#x7C7B;<ul>
<li>&#x5728;&#x57FA;&#x7C7B;&#x91CC;&#x80FD;&#x505A;&#x4E00;&#x4E9B;&#x7EDF;&#x8BA1;&#x4E4B;&#x7C7B;&#x7684;&#x4E8B;</li>
<li>&#x57FA;&#x7C7B;&#xFF0C;&#x6216;&#x8005;&#x7B2C;&#x4E09;&#x65B9;&#x5E93;&#x7684;&#x4E00;&#x5C42;&#x5C01;&#x88C5;&#xFF0C;&#x80FD;&#x8BA9;&#x4F60;&#x7684;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x548C;&#x5916;&#x90E8;&#x5E93;&#x89E3;&#x8026;&#xFF0C;&#x65B9;&#x4FBF;&#x66FF;&#x6362;&#x548C;&#x4FEE;&#x6539;</li>
</ul>
</li>
</ul>
<p>MasterFragment&#x7684;&#x751F;&#x547D;&#x5468;&#x671F;&#xFF1A;</p>
<ul>
<li>onCreate2(View contentView, @Nullable Bundle savedInstanceState)</li>
<li>onDestory2()</li>
<li>onPageVisibleChanged(boolean visible, boolean isFirstTimeVisible, @Nullable Bundle savedInstanceState)</li>
<li>&#x8FD9;&#x91CC;&#x5982;&#x679C;&#x6709;&#x7591;&#x95EE;&#xFF0C;&#x5EFA;&#x8BAE;&#x5148;&#x53BB;&#x770B;&#x770B;Fragmentation&#x7684;&#x6587;&#x6863;&#x548C;demo&#xFF0C;&#x867D;&#x7136;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x7528;&#x5230;&#x5B83;&#x6240;&#x6709;&#x529F;&#x80FD;&#xFF0C;&#x4F46;&#x601D;&#x60F3;&#x4E0A;&#x7684;&#x4E8B;&#xFF0C;&#x90FD;&#x662F;&#x76F8;&#x901A;&#x7684;</li>
<li>&#x5730;&#x5740;&#x5728;&#x8FD9;&#xFF1A;<a href="https://github.com/YoKeyword/Fragmentation" target="_blank">https://github.com/YoKeyword/Fragmentation</a></li>
<li>&#x53E6;&#x5916;&#xFF0C;&#x5207;&#x8BB0;&#x4E0D;&#x8981;&#x76F4;&#x63A5;&#x7528;Fragmentation&#x5347;&#x7EA7;&#x672C;&#x5E93;&#xFF0C;&#x4E3A;&#x4E86;&#x751F;&#x547D;&#x5468;&#x671F;&#x7684;&#x987A;&#x5E8F;&#x95EE;&#x9898;&#xFF0C;&#x5176;&#x6E90;&#x7801;&#x6211;&#x5DF2;&#x7ECF;&#x4FEE;&#x6539;&#x8FC7;&#x4E86;&#xFF0C;&#x540E;&#x9762;&#x4F1A;&#x5BF9;&#x8FD9;&#x91CC;&#x7684;&#x4FEE;&#x6539;&#x505A;&#x6807;&#x8BB0;</li>
</ul>
<p>&#x63D0;&#x4F9B;&#x4E86;&#x51E0;&#x4E2A;&#x6837;&#x677F;&#x9875;&#xFF1A;</p>
<ul>
<li>&#x666E;&#x901A;&#x9875;&#x9762;&#xFF1A;MasterFragment</li>
<li>Tab&#x9875;&#xFF1A;MasterTabFragment</li>
<li>ViewPager&#x9875;&#xFF1A;MasterPagerFragment</li>
<li>&#x5217;&#x8868;&#x9875;&#xFF1A;&#x8FD8;&#x6CA1;</li>
<li>Splash&#x9875;&#xFF1A;&#x8FD8;&#x6CA1;</li>
</ul>
<pre><code>public abstract class BasePage extends MasterFragment {

    /**
     * &#x6240;&#x6709;&#x9875;&#x9762;&#x901A;&#x8FC7;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x6765;&#x6253;&#x5F00;
     * @param a
     * @param pageClass
     * @param bundle
     * @param tmplClass
     */
    public static void startPage(Activity a, Class&lt;? extends MasterPage&gt; pageClass, Bundle bundle, Class&lt;? extends TmplBaseActivity&gt; tmplClass){
        Master.startPage(a, pageClass, bundle, tmplClass);
        //&#x5982;&#x679C;extends MasterActivity&#xFF0C;&#x5219;&#x8FD9;&#x91CC;&#x6362;&#x6210;&#xFF1A;Master.startActivity(a, pageClass, bundle);
    }
    /**
     * &#x6240;&#x6709;&#x9875;&#x9762;&#x901A;&#x8FC7;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x6765;&#x6253;&#x5F00;
     * @param a
     * @param pageClass
     * @param bundle
     */
    public static void startPage(Activity a, Class&lt;? extends MasterPage&gt; pageClass, Bundle bundle){
        Master.startPage(a, pageClass, bundle);
        //&#x5982;&#x679C;extends MasterActivity&#xFF0C;&#x5219;&#x8FD9;&#x91CC;&#x6362;&#x6210;&#xFF1A;Master.startActivity(a, pageClass, bundle);
    }

}


public class DemoFragment extends BasePage {


    @Override
    protected int getLayoutId() {
        return R.layout.ac_demo_component;
    }

    @Override
    protected void onCreate2(View contentView, @Nullable Bundle savedInstanceState) {
        Toaster.toastShort(getActivity().getClass().getName());
        TextView title = (TextView) contentView.findViewById(R.id.title);
        TextView title2 = (TextView) contentView.findViewById(R.id.title2);

        title.setText(getActivity().getClass().getName());
        title2.setText(&quot;haha = &quot; + getArguments().get(&quot;haha&quot;));
    }

    @Override
    protected void onDestroy2() {

    }

    @Override
    protected void onPageVisibleChanged(boolean visible, boolean isFirstTimeVisible, @Nullable Bundle savedInstanceState) {
        String s = &quot;onPageVisibleChanged--{dd}-&gt;&quot; + getClass().getSimpleName() + &quot;, &quot; + (isFirstTimeVisible ? &quot;&#x662F;&quot; : &quot;&#x975E;&quot;) + &quot;&#x7B2C;&#x4E00;&#x6B21;&quot;;
        s = s.replace(&quot;{dd}&quot;, visible ? &quot;&#x6765;&#x4E86;&quot; : &quot;&#x8D70;&#x4E86;&quot;);
        Log.i(&quot;MainActivity&quot;, s);
    }

}
</code></pre><h3 id="6-&#x6253;&#x5F00;&#x754C;&#x9762;">6 &#x6253;&#x5F00;&#x754C;&#x9762;</h3>
<pre><code>&#x6700;&#x539F;&#x59CB;&#x7684;&#x6253;&#x5F00;&#x754C;&#x9762;&#x65B9;&#x6CD5;&#x662F;Master&#x7C7B;&#x91CC;&#x7684;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#xFF1A;
public static void startPage(Activity a, Class&lt;? extends MasterFragment&gt; clazz, Bundle b, Class&lt;? extends Activity&gt; tmplActvity){
    Intent intent = new Intent(a, tmplActvity);
    intent.putExtra(&quot;data&quot;, b);
    intent.putExtra(&quot;page&quot;, clazz.getName());
    a.startActivity(intent);
}

public static void startPageForResult(Activity a, Class&lt;? extends MasterFragment&gt; clazz, Bundle b, Class&lt;? extends Activity&gt; tmplActvity, int requestCode){
    Intent intent = new Intent(a, tmplActvity);
    intent.putExtra(&quot;data&quot;, b);
    intent.putExtra(&quot;page&quot;, clazz.getName());
    a.startActivityForResult(intent, requestCode);
}

&#x5927;&#x4F53;&#x4E0A;&#x6240;&#x6709;&#x7684;trick&#x90FD;&#x5728;&#x8FD9;&#x91CC;&#x4E86;&#xFF0C;&#x5176;&#x5B9E;&#x8FD9;&#x6CA1;&#x5565;&#xFF0C;&#x5C31;&#x662F;&#x6307;&#x5B9A;&#x6253;&#x5F00;&#x54EA;&#x4E2A;Activity&#xFF0C;&#x8BA9;&#x5B83;&#x52A0;&#x8F7D;&#x54EA;&#x4E2A;Fragment&#xFF0C;&#x54CE;&#x5367;&#x69FD;&#xFF0C;&#x4E00;&#x70B9;&#x513F;&#x6CA1;&#x6280;&#x672F;&#x542B;&#x91CF;
</code></pre><p>&#x63A5;&#x6536;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#xFF1A;</p>
<pre><code>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
}
</code></pre><h3 id="7-&#x72B6;&#x6001;&#x680F;&#x4E00;&#x4F53;&#x5316;">7 &#x72B6;&#x6001;&#x680F;&#x4E00;&#x4F53;&#x5316;</h3>
<pre><code>&#x6CE8;&#x610F;&#xFF0C;&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x603B;&#x662F;&#x5F97;&#x4E00;&#x5757;&#x7528;&#xFF0C;&#x4E0D;&#x8981;&#x5355;&#x72EC;&#x7528;
///status bar&#x548C;navigate bar&#x7684;&#x989C;&#x8272;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x6D45;&#x8272;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x914D;&#x5408;SystamBarExtra&#x91CC;&#x7684;&#x65B9;&#x6CD5;&#x52A0;&#x4EE5;&#x4F18;&#x5316;&#xFF0C;&#x4F46;&#x4E0D;&#x652F;&#x6301;&#x4E09;&#x661F;&#x624B;&#x673A;
getAgent().renderSystemBar(Color.YELLOW, Color.GREEN);
///status bar&#x548C;navigate bar&#x662F;&#x5426;&#x88AB;&#x4FB5;&#x5360;
getAgent().enableSystemBarTakenByContent(false);


&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x5176;&#x5B9E;&#x662F;&#x5BF9;&#x5E94;&#x7740;&#x4E3B;&#x9898;&#x91CC;&#x7684;&#xFF1A;
&lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
&lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
&lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;
&#x548C;&#x5E03;&#x5C40;&#x91CC;&#x7684;&#xFF1A;
fitSystemWindow=&quot;true&quot;

&#x5F53;&#x7136;&#xFF0C;&#x4EE3;&#x7801;&#x91CC;&#x8BBE;&#x7F6E;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x6BD4;&#x8F83;&#x9AD8;
</code></pre><p>&#x4E0B;&#x9762;&#x591A;&#x8BF4;&#x70B9;&#xFF0C;systembar&#x6D89;&#x53CA;&#x5230;&#x4E24;&#x4E2A;&#x95EE;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x95EE;&#x9898;1&#xFF1A;&#x989C;&#x8272;&#x8BBE;&#x7F6E;&#xFF0C;&#x53EF;&#x4EE5;&#x5F00;&#x542F;&#x548C;&#x5173;&#x95ED;&#xFF0C;&#x5206;status bar&#x548C;navigation bar</li>
<li>&#x95EE;&#x9898;2&#xFF1A;&#x662F;&#x5426;&#x4FB5;&#x5165;&#xFF0C;&#x53EF;&#x4EE5;&#x5F00;&#x542F;&#x548C;&#x5173;&#x95ED;&#xFF0C;&#x548C;&#x989C;&#x8272;&#x8BBE;&#x7F6E;&#x4E0D;&#x51B2;&#x7A81;</li>
</ul>
<p>&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onCreate</span><span class="hljs-params">(Bundle savedInstanceState)</span> </span>{
    <span class="hljs-keyword">super</span>.onCreate(savedInstanceState);
    setContentView(R.layout.sample_ac_main);

    <span class="hljs-comment">//&#x5173;&#x95ED;StatusBar&#x548C;NavigationBar&#x4FB5;&#x5165;</span>
    getAgent().enableSystemBarTakenByContent(<span class="hljs-keyword">false</span>);

    <span class="hljs-comment">//&#x7ED9;StatusBar&#x548C;NavigaionBar&#x67D3;&#x8272;</span>
    getAgent().renderSystemBar(Color.parseColor(<span class="hljs-string">&quot;#55ff0000&quot;</span>), Color.parseColor(<span class="hljs-string">&quot;#55ff0000&quot;</span>));

}
</code></pre>
<ul>
<li>&#x89E3;&#x6790;&#xFF1A;<ul>
<li>&#x8FD9;&#x91CC;&#x5C31;&#x662F;&#x5BF9;&#x5F00;&#x6E90;&#x4EE3;&#x7801;SystemBarTintManager&#x7684;&#x7B80;&#x5355;&#x5C01;&#x88C5;</li>
<li>enableSystemBarTakenByContent&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x8BBE;&#x7F6E;&#x6839;&#x5E03;&#x5C40;&#x7684;<code>android:fitsSystemWindows</code>&#x5C5E;&#x6027;</li>
</ul>
</li>
</ul>
<p>fitSystemWindows&#x662F;true&#x65F6;&#xFF1A;enableSystemBarTakenByContent(false)&#xFF0C;&#x5185;&#x5BB9;&#x7ED9;SystemBar&#x7559;&#x7A7A;
<img src="img/mm2.png" alt=""></p>
<p>fitSystemWindows&#x662F;false&#x65F6;&#xFF1A;enableSystemBarTakenByContent(true)&#xFF0C;&#x5185;&#x5BB9;&#x4FB5;&#x5165;SystemBar
<img src="img/mm3.png" alt=""></p>
<p>&#x5176;&#x4ED6;&#x95EE;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x5173;&#x4E8E;clipToPadding&#x548C;clipToChildren&#xFF1A;&#x9ED8;&#x8BA4;&#x90FD;&#x4E3A;true</li>
<li><a href="http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0317/2613.html" target="_blank">http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0317/2613.html</a></li>
<li>&#x597D;&#x50CF;&#x548C;&#x6EDA;&#x52A8;&#x6709;&#x5173;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0A;&#x4E0B;&#x6EDA;&#x52A8;&#x65F6;&#xFF0C;&#x5185;&#x5BB9;&#x662F;&#x5426;&#x53EF;&#x4EE5;&#x6EDA;&#x52A8;&#x5230;&#x6807;&#x9898;&#x680F;&#x91CC;</li>
</ul>
<pre><code>&lt;ListView
    android:layout_gravity=&quot;center_vertical&quot;
    android:id=&quot;@+id/list&quot;
    android:clipChildren=&quot;false&quot;
    android:clipToPadding=&quot;false&quot;
    android:paddingTop=&quot;50dip&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot; /&gt;
</code></pre><p>ListView&#x521D;&#x59CB;&#x5316;&#x4E4B;&#x540E;&#xFF0C;&#x7531;&#x4E8E;top&#x7684;50dp&#x7684;padding&#xFF0C;&#x770B;&#x4F3C;&#x9876;&#x7740;&#x6807;&#x9898;&#x680F;&#xFF0C;&#x4F46;&#x5F80;&#x4E0A;&#x6EDA;&#x52A8;&#x65F6;&#xFF0C;&#x5185;&#x5BB9;&#x5C31;&#x4F1A;&#x8DD1;&#x5230;padding&#x7684;50dp&#x91CC;&#xFF0C;&#x4E5F;&#x5C31;&#x80FD;&#x4ECE;&#x6807;&#x9898;&#x680F;&#x770B;&#x5230;&#x4E86;&#xFF08;&#x5982;&#x679C;&#x6807;&#x9898;&#x680F;&#x5E26;&#x900F;&#x660E;&#xFF09;</p>
<p>&#x5B9E;&#x9645;&#x7528;&#x4F8B;&#xFF0C;&#x8FD8;&#x5F97;&#x8003;&#x8651;systembar&#x7684;&#x80CC;&#x666F;&#x53D8;&#x6210;&#x6D45;&#x8272;&#x65F6;&#xFF0C;&#x5B57;&#x4F53;&#x989C;&#x8272;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x4E09;&#x661F;&#x624B;&#x673A;&#x597D;&#x50CF;&#x4E0D;&#x592A;&#x652F;&#x6301;&#x72B6;&#x6001;&#x680F;&#x80CC;&#x666F;&#x6D45;&#x8272;&#xFF08;&#x4F1A;&#x53D8;&#x6210;&#x7070;&#x8272;&#x4EE3;&#x66FF;&#xFF09;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">breakerSystemBar</span><span class="hljs-params">(AyoActivity a)</span></span>{
    a.agent.enableSystemBarTakenByContent(<span class="hljs-keyword">false</span>);
    a.agent.renderSystemBar(Color.WHITE, Color.WHITE);

    <span class="hljs-comment">/// &#x4E0B;&#x9762;&#x8FD9;&#x4E09;&#x4E2A;&#x63A7;&#x5236;&#x72B6;&#x6001;&#x680F;&#x5B57;&#x4F53;&#x989C;&#x8272;&#xFF0C;&#x5206;&#x522B;&#x7BA1;&#xFF1A;6.0&#xFF0C; MIUI&#xFF0C;&#x9B45;&#x65CF;&#x7CFB;&#x7EDF;----&#x5F53;systembar&#x7684;&#x80CC;&#x666F;&#x88AB;&#x8BBE;&#x7F6E;&#x6210;&#x6D45;&#x8272;&#xFF0C;&#x5B57;&#x4F53;&#x5C31;&#x5F97;&#x53D8;&#x6210;&#x6DF1;&#x8272;&#xFF08;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x80CC;&#x666F;&#x662F;&#x6DF1;&#x8272;&#xFF0C;&#x5B57;&#x4F53;&#x9ED8;&#x8BA4;&#x662F;&#x6D45;&#x8272;&#xFF09;</span>
    <span class="hljs-keyword">if</span> (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
        a.getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
    MIUISetStatusBarLightMode(a.getWindow(), <span class="hljs-keyword">true</span>);
    FlymeSetStatusBarLightMode(a.getWindow(), <span class="hljs-keyword">true</span>);

}

<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">MIUISetStatusBarLightMode</span><span class="hljs-params">(Window window, <span class="hljs-keyword">boolean</span> dark)</span> </span>{
    <span class="hljs-keyword">boolean</span> result = <span class="hljs-keyword">false</span>;
    <span class="hljs-keyword">if</span> (window != <span class="hljs-keyword">null</span>) {
        Class clazz = window.getClass();
        <span class="hljs-keyword">try</span> {
            <span class="hljs-keyword">int</span> darkModeFlag = <span class="hljs-number">0</span>;
            Class layoutParams = Class.forName(<span class="hljs-string">&quot;android.view.MiuiWindowManager$LayoutParams&quot;</span>);
            Field field = layoutParams.getField(<span class="hljs-string">&quot;EXTRA_FLAG_STATUS_BAR_DARK_MODE&quot;</span>);
            darkModeFlag = field.getInt(layoutParams);
            Method extraFlagField = clazz.getMethod(<span class="hljs-string">&quot;setExtraFlags&quot;</span>, <span class="hljs-keyword">int</span>.class, <span class="hljs-keyword">int</span>.class);
            <span class="hljs-keyword">if</span>(dark){
                extraFlagField.invoke(window,darkModeFlag,darkModeFlag);<span class="hljs-comment">//&#x72B6;&#x6001;&#x680F;&#x900F;&#x660E;&#x4E14;&#x9ED1;&#x8272;&#x5B57;&#x4F53;</span>
            }<span class="hljs-keyword">else</span>{
                extraFlagField.invoke(window, <span class="hljs-number">0</span>, darkModeFlag);<span class="hljs-comment">//&#x6E05;&#x9664;&#x9ED1;&#x8272;&#x5B57;&#x4F53;</span>
            }
            result=<span class="hljs-keyword">true</span>;
        }<span class="hljs-keyword">catch</span> (Exception e){

        }
    }
    <span class="hljs-keyword">return</span> result;
}

<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">FlymeSetStatusBarLightMode</span><span class="hljs-params">(Window window, <span class="hljs-keyword">boolean</span> dark)</span> </span>{
    <span class="hljs-keyword">boolean</span> result = <span class="hljs-keyword">false</span>;
    <span class="hljs-keyword">if</span> (window != <span class="hljs-keyword">null</span>) {
        <span class="hljs-keyword">try</span> {
            WindowManager.LayoutParams lp = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField(<span class="hljs-string">&quot;MEIZU_FLAG_DARK_STATUS_BAR_ICON&quot;</span>);
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField(<span class="hljs-string">&quot;meizuFlags&quot;</span>);
            darkFlag.setAccessible(<span class="hljs-keyword">true</span>);
            meizuFlags.setAccessible(<span class="hljs-keyword">true</span>);
            <span class="hljs-keyword">int</span> bit = darkFlag.getInt(<span class="hljs-keyword">null</span>);
            <span class="hljs-keyword">int</span> value = meizuFlags.getInt(lp);
            <span class="hljs-keyword">if</span> (dark) {
                value |= bit;
            } <span class="hljs-keyword">else</span> {
                value &amp;= ~bit;
            }
            meizuFlags.setInt(lp, value);
            window.setAttributes(lp);
            result = <span class="hljs-keyword">true</span>;
        } <span class="hljs-keyword">catch</span> (Exception e) {

        }
    }
    <span class="hljs-keyword">return</span> result;
}
</code></pre>
<h3 id="8-&#x6A21;&#x677F;activity&#x58F0;&#x660E;&#xFF1A;&#x5185;&#x7F6E;&#x548C;&#x81EA;&#x5B9A;&#x4E49;&#xFF0C;activity&#x5728;manifest&#x91CC;&#x914D;&#x7F6E;&#x7684;&#x53EF;&#x9009;&#x9879;">8 &#x6A21;&#x677F;Activity&#x58F0;&#x660E;&#xFF1A;&#x5185;&#x7F6E;&#x548C;&#x81EA;&#x5B9A;&#x4E49;&#xFF0C;Activity&#x5728;manifest&#x91CC;&#x914D;&#x7F6E;&#x7684;&#x53EF;&#x9009;&#x9879;</h3>
<h3 id="9-&#x5C4F;&#x5E55;&#x65CB;&#x8F6C;">9 &#x5C4F;&#x5E55;&#x65CB;&#x8F6C;</h3>
<h3 id="10-ayo-menu&#x7684;&#x4F7F;&#x7528;&#xFF1A;&#x5199;demo&#x5FC5;&#x5907;&#x5C0F;&#x5E2E;&#x624B;">10 ayo-menu&#x7684;&#x4F7F;&#x7528;&#xFF1A;&#x5199;demo&#x5FC5;&#x5907;&#x5C0F;&#x5E2E;&#x624B;</h3>
<h3 id="11-&#x8FC7;&#x573A;&#x52A8;&#x753B;&#xFF0C;&#x548C;transition&#x52A8;&#x753B;">11 &#x8FC7;&#x573A;&#x52A8;&#x753B;&#xFF0C;&#x548C;Transition&#x52A8;&#x753B;</h3>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="design.html" class="navigation navigation-prev " aria-label="Previous page: MeterialDesign详解">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="systembartint.html" class="navigation navigation-next " aria-label="Next page: SystembarTint">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"AyoComponent基础库--Activity和Fragment","level":"1.15","depth":1,"next":{"title":"SystembarTint","level":"1.16","depth":1,"path":"systembartint.md","ref":"systembartint.md","articles":[]},"previous":{"title":"MeterialDesign详解","level":"1.14","depth":1,"path":"design.md","ref":"design.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"component.md","mtime":"2017-04-09T15:14:16.337Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-04-09T17:03:25.521Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

